<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('植保列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">

        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <input type="hidden" id="caiId" name="caiId" th:value="${caiId}"/>
                        <li class="select-time">
                            <label>日期： </label>
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]" lay-key="1" th:value="${beginTime}">
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]" lay-key="2" th:value="${endTime}">
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" href="#" onclick="detail()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="col-sm-12 select-table table-striped">

            <table id="bootstrap-table" data-mobile-responsive="true">
            </table>
        </div>
        <div class="bottom-btns"></div>

    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:ncZhibao:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:ncZhibao:remove')}]];
    var prefix = ctx + "system/ncZhibao";
    var beginTime=[[${beginTime}]];
    var endTime=[[${endTime}]];
    var caiId=[[${caiId}]];
    $(function() {
        var options1 = {

            url: prefix + "/selectzhibaoDetailList",
            createUrl: prefix + "/add/1",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "植保",
            showExport: false,
            showSearch: false,
            showRefresh: false,
            showColumns: false,
            showToggle: false,
            queryParams : {conformStatus:1,beginTime:beginTime,endTime:endTime,caiId:caiId},
            columns: [{
                checkbox: true
            },
                {
                    field : 'zhibaoId',
                    title : '编号',
                    visible: false
                },
                {
                    title: '序号',
                    formatter: function (value, row, index) {
                        return $.table.serialNumber(index);
                    }
                },

                {
                    field : 'planId',
                    title : '计划编号',
                    sortable: true
                },
                {
                    field : 'cropNameCn',
                    title : '作物名称',
                    sortable: true
                },
                {
                    field : 'cropTypeCn',
                    title : '作物品种',
                    sortable: true
                },
                {
                    field : 'teamCn',
                    title : '生产班组',
                    sortable: true
                },
                {
                    field : 'planTime',
                    title : '定植/播种时间',
                    sortable: true,
                    formatter: function(value, row, index) {
                        return dateFtt(value)
                    }
                },

                {
                    field : 'landType',
                    title : '生产大棚',
                    sortable: true,
                    formatter: function (value, row, index) {
                        if (1 == value) {
                            return "日光温室"
                        }
                        if (2 == value) {
                            return "春秋棚"
                        }
                        if (3 == value) {
                            return "连栋温室"
                        }
                        if (4 == value) {
                            return "露地"
                        }
                        return "--";
                    }
                },
                {
                    field : 'sumArea',
                    title : '种植面积(m<sup>2</sup>)',
                    sortable: true
                },
                {
                    field : 'createTime',
                    title : '提交时间',
                    sortable: true,
                    formatter: function(value, row, index) {
                        return dateFtt(value)
                    }
                },
                {
                    field : 'createBy',
                    title : '提交人',
                    sortable: true
                },
                {
                    field : 'symptom',
                    title : '植物病症',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value);
                    }
                },

                {
                    field : 'causes',
                    title : '发病原因',
                    sortable: true
                },
                {
                    field : 'proposal',
                    title : '植保意见',
                    sortable: true
                },
                {
                    field : 'applicationTime',
                    title : '施药日期',
                    sortable: true,
                    formatter: function(value, row, index) {
                        return dateFtt(value)
                    }
                },
                {
                    field : 'drugCode',
                    title : '药品批次号',
                    sortable: true
                },
                {
                    field : 'drugName',
                    title : '药品名称',
                    sortable: true
                },
                {
                    field : 'executeType',
                    title : '施药方式',
                    sortable: true,
                    formatter: function (value, row, index) {
                        if (1 == value) {
                            return "根灌"
                        }
                        if (2 == value) {
                            return "页面喷洒"
                        }
                        return "--";
                    }
                },
                {
                    field : 'drugAmount',
                    title : '施药量',
                    sortable: true
                },
                {
                    field : 'unit',
                    title : '单位',
                    sortable: true,
                    formatter: function (value, row, index) {
                        if (1 == value) {
                            return "盒"
                        }
                        if (2 == value) {
                            return "袋"
                        }
                        if (3 == value) {
                            return "ml"
                        }
                        return "--";
                    }
                },


                {
                    field : 'validDays',
                    title : '有效期（天）',
                    sortable: true
                },
                {
                    field : 'executeBy',
                    title : '植保人',
                    sortable: true
                },
                {
                    field : 'sourceType',
                    title : '来源',
                    sortable: true,
                    formatter: function (value, row, index) {
                        if (1 == value) {
                            return "推送"
                        }
                        if (2 == value) {
                            return "新增"
                        }
                        return "--";

                    }
                },
                {
                    field : 'remark',
                    title : '备注',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value);
                    }
                },
            ]
        };
        $.table.init(options1);
    });
    function reload() {
        $.table.refresh();
    }
    function detail(){
        var link=ctx+"system/ncZhibao/selectDetail?benginTime="+$("#startTime").val()+"&endTime="+$("#endTime").val()+"&caiId="+$("#caiId").val();
        window.location.href=link;
    }

</script>
</body>
</html>